//
//  ClaimProgressViewController.m
//  MemberProject
//
//  Created by vincent luo on 15/7/17.
//  Copyright (c) 2015年 MAC OS X. All rights reserved.
//

#import "ClaimProgressViewController.h"
#import "ClaimProgressTableViewCell.h"
@interface ClaimProgressViewController ()
@property (nonatomic,strong) NSArray *titleArr;
@property (nonatomic,strong) NSArray *contentArr;
//@property (nonatomic,strong) NSArray *statusArr;

@end

@implementation ClaimProgressViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"自助理赔进度";
    // Do any additional setup after loading the view from its nib.
    
    [self setupView];
    
    [self setupData];
}

-(void)setupView
{
    [self.mainTableView registerNib:[UINib nibWithNibName:@"ClaimProgressTableViewCell" bundle:nil] forCellReuseIdentifier:@"CellIdentifier"];
    self.mainTableView.layer.borderWidth = 0.7;
    self.mainTableView.layer.cornerRadius = 5;
    self.mainTableView.layer.borderColor=[UIColor colorWithRed:231/255.0 green:231/255.0 blue:231/255.0 alpha:1].CGColor;
    
    
//    CGFloat height = (SCREEN_WIDTH-20.0)/300.0*275.0f;
//    
//    UIView *backView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-20, height+10)];
//    self.statusImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 5, backView.width, height)];
//    [backView addSubview:self.statusImageView];
//    
//    
//    self.mainTableView.tableFooterView = backView;
    
}

-(void)setupData
{
    self.titleArr = @[@"保单号:",@"出险日期:",@"银行账户:",@"汇款日期:",@"申请金额:",@"垫付金额:",@"汇款金额:",@"审批状态:"];
//    @[insuranceNo,dangerDate,bankAccount,remittanceDate,applyCost,advanceCost,realCost,status]
//    @[insuranceNo,dangerDate,remittanceDate,bankAccount,applyCost,advanceCost,realCost,status]
    
    
     NSString *insuranceNo =  [UserInsuranceManager sharedManager].userInsurance.insuranceNo;
    if (!insuranceNo) {
        insuranceNo = @"";
    }
    
//    self.statusArr = @[@"已受理",@"审批中",@"已通知",@"已给付",@"撤件"];
    if (self.modelClaim) {
        NSString *dangerDate = [Utils changeDayDateFromService:self.modelClaim.dangerDate];
        NSString *remittanceDate =@"";
        if (self.modelClaim.remittanceDate!=nil&&self.modelClaim.remittanceDate.length>0) {
            remittanceDate =[Utils changeDayDateFromService:self.modelClaim.remittanceDate];
        }
        NSString *bankAccount = self.modelClaim.bankAccount;

        
        
        
        NSString *applyCost = self.modelClaim.applyCost;
        NSString *advanceCost= self.modelClaim.advanceCost;
        NSString *realCost = self.modelClaim.realCost;
        
        
        NSString *status = @"";
        if (self.modelClaim.claimStatusName) {
//            NSInteger type = self.modelClaim.claimStatus.intValue;
//            
//            status = self.statusArr[type];
            status = self.modelClaim.claimStatusName;
        }
        
        
        
        self.contentArr = @[insuranceNo,dangerDate,bankAccount,remittanceDate,applyCost,advanceCost,realCost,status];
        
        
    }else
    {
        self.contentArr = @[@"",@"",@"",@"",@"",@"",@"",@""];
    }
    
    
    
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.titleArr.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 40;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellStr =@"CellIdentifier";
    ClaimProgressTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr forIndexPath:indexPath];
    cell.titleLabel.text = self.titleArr[indexPath.row];
    cell.contentLabel.text = self.contentArr[indexPath.row];
    
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
